A software developer can use build automation tools and a compiler or interpreter provided by an integrated development environment to create a software product. When compiling a high-level program into a machine language, it is an established practice to translate the source program into one or more intermediate forms before finally translating the source program into the machine language. The various intermediate forms can be processed by various components of a compiler infrastructure. For example, LLVM (formerly Low Level Virtual Machine) is a compiler infrastructure that can provide the middle layers of a complete compiler system. LLVM is designed for compile-time, link-time, run-time, and “idle-time” optimization of programs written in arbitrary programming languages. LLVM is language agnostic and can be used with a variety of front ends.
One front end used by LLVM is Clang, which is a C language front-end for LLVM. Generically, the C language is a general-purpose programming language that has been closely associated with the UNIX operating system. However, the C language has found use in nearly all aspects of software development. Clang can be used as a front-end compiler for software written in Objective-C. Objective-C is a superset of the C programming language and provides object-oriented capabilities and a dynamic runtime. Objective-C inherits the syntax, primitive types, and flow control statements of C and adds syntax for defining classes and methods. Objective-C also adds language-level support for object graph management and object literals while providing dynamic typing and binding, deferring many responsibilities until runtime.
Objective-C is a ‘strict superset’ of C. The syntax for non-object-oriented operations, including primitive variables, pre-processing, expressions, function declarations, and function calls are identical to that of C, while the syntax for object-oriented features is an implementation of messaging derived from the Smalltalk object-oriented language. Accordingly, it is possible to compile any C program with an Objective-C compiler, and to freely include C code within an Objective-C class.
The C compatibility of Objective-C provides benefits and drawbacks. The C language is a relatively “low level” language in terms of high-level programming languages, and performs operations using similar objects as the underlying computer system, such as characters, numbers, and addresses. However, C is a weakly typed language that engages in inherently unsafe memory operations. Such features have historically provided a performance advantage to applications written in the C language, but can require extensive diligence by application developers to protect against unanticipated security vulnerabilities.